<link rel="stylesheet" href="../component/bootstrap/css/bootstrap-tagsinput.css">

<div class="college-content">
    <blockquote class="layui-elem-quote">
        <button class="layui-btn create-item"><i class="layui-icon">&#xe654;</i>添加学院</button>
    </blockquote>

    <form class="layui-form" lay-filter="searchCollegeForm" id="searchCollegeForm">
        <div class="layui-form-item">
            <label class="layui-form-label">学院标题</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="title" placeholder="请输入标题" class="layui-input"
                       lay-filter="searchCollegeForm">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">学院标签</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <input type="text" name="tag" placeholder="请输入标签" class="layui-input"
                       lay-filter="searchCollegeForm">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">上线状态</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <select name="status" class="layui-input">
                    <option value="" selected>全部</option>
                    <option value="00">下线</option>
                    <option value="01">上线</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">学院作者</label>
            <div class="layui-input-block layui-col-md5 no-margin-left">
                <select name="author">

                </select>
            </div>
            <input class="layui-btn search" type="button" value="搜索" lay-submit lay-filter="searchCollegeForm"/>
        </div>
    </form>
    <!--<blockquote class="layui-elem-quote">
        <button class="layui-btn create-item"><i class="layui-icon">&#xe654;</i>创建头条</button>
    </blockquote>-->
    <div class="college-table"></div>
    <script type="text/html" id="collegeForm">
        <form class="layui-form padding-5 layui-dialog college-form">
            <div class="layui-form-item">
                <label class="layui-form-label required">标题：</label>
                <div class="layui-input-block">
                    <input type="text" name="title" required lay-verify="required" placeholder="请输入标题"
                           autocomplete="off" value="{{d.data.title||''}}"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item ">
                <label class="layui-form-label required">归属模块：</label>
                <div class="layui-input-block">
                    <select name="channelId" class="layui-input" disabled>
                        <option value="6">学院</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">作者：</label>
                <div class="layui-input-block">
                    <select name="author" class="layui-input">
                        {{# layui.each(d.authors, function(index, item){ }}
                        <option value="{{item.id}}" {{# if(item.id== d.data.author){}}selected{{#}}}>
                            {{item.displayName}}
                        </option>
                        {{# }); }}
                    </select>
                </div>
            </div>
            <div class="layui-form-item ">
                <label class="layui-form-label required">上线状态：</label>
                <div class="layui-input-block">
                    <select name="status" class="layui-input">
                        {{# layui.each(d.statusCollections, function(index, item){ }}
                        <option value="{{item.code}}" {{# if(item.code== d.data.status){}}selected{{#}}}>
                            {{item.description}}
                        </option>
                        {{# }); }}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label required">封面：</label>
                <div class="layui-input-block">
                    <div class="image-container">
                        <input type="hidden" name="image" required lay-verify="required"
                               autocomplete="off" value="{{d.data.image||''}}"
                               class="layui-input">
                        <div class="college-image image-item-container">
                            {{# if(d.data.image){}}
                            <img src="{{d.data.image||''}}" class="image-item add-image"/>
                            {{#}else{}}
                            <span class="image-placeholder add-image">+</span>
                            {{#}}}
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">标签：</label>
                <div class="layui-input-block">
                    <input type="text" data-role="tagsinput" name="tag"
                           placeholder="逗号或空格分隔"
                           autocomplete="off" value="{{d.data.tag||''}}"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">阅读量：</label>
                <div class="layui-input-block">
                    <input type="number" name="readAmount"
                           placeholder="阅读量"
                           autocomplete="off" value="{{d.data.readAmount||'0'}}" lay-verify="positiveInteger"
                           class="layui-input">
                </div>
            </div>
            <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label required">失效时间：</label>-->
            <!--<div class="layui-input-inline">-->
            <!--<input type="number" name="expireTime" placeholder="6<=失效时间<24"-->
            <!--lay-verify="required|number|expireTime"-->
            <!--autocomplete="off" value="{{d.data.expireTimeInHour || ''}}"-->
            <!--class="layui-input">-->
            <!--</div>-->
            <!--<div class="layui-input-inline line-height-38">小时</div>-->
            <!--</div>-->

            <div class="layui-form-item">
                <label class="layui-form-label required">内容：</label>
                <div class="layui-input-block" style="height: 320px">
                    <div type="text/plain" id="content" name="content" style="width:100%;height:200px;">
                        {{d.data.content||''}}
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn save" lay-submit lay-filter="{{d.model}}">保存</button>
                    <button type="reset" class="layui-btn">重置</button>
                </div>
            </div>
            <input type="hidden" name="id" value="{{d.data.id||''}}"/>
        </form>
    </script>
</div>

<script src="../component/umeditor/umeditor.js"></script>
<script src="../component/umeditor/umeditor.config.js"></script>
<script src="../component/umeditor/lang/zh-cn/zh-cn.js"></script>
<script src="../component/bootstrap/js/bootstrap-tagsinput.min.js"></script>
<script type="text/javascript" src="../js/college.js"></script>